﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using SMS.Entities;
using SMS.DAL;
using SMS.Entities.Report;

namespace SMS.Web.Service
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ReportService" in code, svc and config file together.
    public class ReportService : IReportService
    {
        public void DoWork()
        {
        }

        public List<SaleReport> GetSaleDetailReportList(string UserName, DateTime FromDate, DateTime ToDate,string SearchOption, out SMSException serviceError)
        {
            try
            {
                serviceError = null;
                return new ReportDA().GetSalesReportDataList(UserName, FromDate, ToDate,SearchOption);
            }
            catch (Exception ex)
            {
                serviceError = new Entities.SMSException(ex);
                return null;
            }
        }

        public List<ProductSaleReport> GetProductSaleReportDataList(string UserName, DateTime FromDate, DateTime ToDate, string SearchOption, out SMSException serviceError)
        {
            try
            {
                serviceError = null;
                return new ReportDA().GetProductSaleReportDataList(UserName, FromDate, ToDate, SearchOption);
            }
            catch (Exception ex)
            {
                serviceError = new Entities.SMSException(ex);
                return null;
            }
        }

        public List<CustomerReport> GetCustomerReportDataList(string UserName, DateTime FromDate, DateTime ToDate, string SearchOption, out SMSException serviceError)
        {
            try
            {
                serviceError = null;
                return new ReportDA().GetCustomerReportDataList(UserName, FromDate, ToDate, SearchOption);
            }
            catch (Exception ex)
            {
                serviceError = new Entities.SMSException(ex);
                return null;
            }
        }

        public List<CustomerReport> GetIndividualCustomerReportDataList(string UserName,int CustomerID, DateTime FromDate, DateTime ToDate, string SearchOption, out SMSException serviceError)
        {
            try
            {
                serviceError = null;
                return new ReportDA().GetIndividualCustomerReportDataList(UserName,CustomerID, FromDate, ToDate, SearchOption);
            }
            catch (Exception ex)
            {
                serviceError = new Entities.SMSException(ex);
                return null;
            }
        }

        public List<NewCustomerReport> GetNewCustomerReportDataList(string UserName, DateTime FromDate, DateTime ToDate, string SearchOption, out SMSException serviceError)
        {
            try
            {
                serviceError = null;
                return new ReportDA().GetNewCustomerReportDataList(UserName, FromDate, ToDate, SearchOption);
            }
            catch (Exception ex)
            {
                serviceError = new Entities.SMSException(ex);
                return null;
            }
        }
    }
}
